package com.smscenter.server.core.ztsms;


import com.smscenter.server.core.IExecutor;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.Map;

/**
 * Created by ShanFei on 2017-02-16.
 */
public class ZtSmsExecutor implements IExecutor {
    public String excute(Map<String, Object> params) throws IOException {
        String url ="http://www.ztsms.cn/sendNSms.do";
        String username =params.get("loginName").toString();//内容
        String password =params.get("loginPassword").toString();//密码
        String mobile =params.get("phone").toString();//号码
        String content =params.get("content").toString();//内容
        String productid =params.get("productid").toString();//产品id
        String xh ="";//没有
        String tkey =TimeUtil.getNowTime("yyyyMMddHHmmss");
        try{
            content= URLEncoder.encode(content,"utf-8");
        }catch (Exception e) {
        }
        String param="url="+url+"&username="+username+"&password="+MD5Gen.getMD5(MD5Gen.getMD5(password)+tkey)+"&tkey="+tkey+"&mobile="+mobile+"&content="+content+"&productid="+productid+"&xh"+xh;
        String ret=HttpRequest.sendPost(url, param);//sendPost or sendGet  即get和post方式
        //System.out.println("ret:"+ret);
        //System.out.println(param);
        return ret;
    }
}
